import { defineStore } from 'pinia'
import { ref, reactive } from 'vue'

export const useUserStore = defineStore('user', () => {
  const userInfo = ref({
    id: null,
    name: '',
    role: '',
    avatarUrl: ''
  })
  //修改用户信息
  function setUserInfo(data) {
    userInfo.value = data
    
    console.log(userInfo.value, '登录之后的用户信息')
  }

  return { userInfo, setUserInfo,  }
  

},{ persist:true //启用持久化
  })